package com.javaoopseven;

import java.security.KeyException;
import java.sql.SQLException;
import java.util.Scanner;

public class User {


    public void count(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int i = scanner.nextInt();
        System.out.println("请输入第二个数字");
        int i1 = scanner.nextInt();
        if(i1==0){
            throw new kh63Exception("大飒飒发的第三方三");
        }
        int v=i/i1;
        System.out.println(v);
        System.out.println("测试");
        System.out.println("测试");
        System.out.println("测试");
    }

    public void run() throws SQLException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        String next = scanner.next();
        if(next.equals("admin")){
            System.out.println("登录成功..");
        }
        System.out.println("请选择以下的操作：1：点餐");
        System.out.println("请选择您的操作：");
        int i = scanner.nextInt();
        System.out.println("点餐流程.....");
        System.out.println("点餐流程.....");
        System.out.println("点餐流程.....");
    }

    public void login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入用户名");
        String next = scanner.next();
        if(next.equals("admin")){
            System.out.println("登录成功..");
        }
       try { //可能会出现异常的代码
           System.out.println("请选择以下的操作：1：点餐");
           System.out.println("请选择您的操作：");
           int i = scanner.nextInt();
       }catch (IndexOutOfBoundsException e){
           //处理异常
           System.out.println("系统出异常了....");
           e.printStackTrace();
           //  System.exit(1) System.exit(1);
       }catch (RuntimeException e){
           //处理异常
           System.out.println("系统出异常了....");
           e.printStackTrace();
           //  System.exit(1) System.exit(1);
       }catch (Exception e){
            //处理异常
           System.out.println("系统出异常了....");
           e.printStackTrace();
          //  System.exit(1) System.exit(1);
       }finally {
           System.out.println("点餐流程.....");
           System.out.println("点餐流程.....");
           System.out.println("点餐流程.....");
       }


    }
}
